home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / actlib13.zip / TOOLS.ZIP / TESTDRV.C < prev    next >
C/C++ Source or Header  |  1993-04-15  |  898b  |  41 lines

  1. /*  Copyright (C) 1993   Marc Stern  (internet: stern@mble.philips.be)  */
  2.  
  3. #include "tools.h"
  4. #include <bios.h>
  5.  
  6.  
  7. /***
  8.  *
  9.  *  Function   :    test_drive
  10.  *
  11.  *  Topics     :    Test the availability of a drive.
  12.  *
  13.  *  Parameters :    in    int drive         0 = A:, 1 = B:
  14.  *
  15.  *  Return code:    0 if OK
  16.  *                  2 if not formatted
  17.  *                  3 if write-protected
  18.  *                  128 (0x80) if floppy not inserted
  19.  *                  other if not available
  20.  ***/
  21.  
  22. int test_drive( int drive )
  23.  
  24. { int result;
  25.   char buffer[512];
  26.  
  27. //  do result = biosdisk( 4, drive, 0, 0, 1, 1, buffer );
  28. //  while ( result == 0x06 );
  29.  
  30.   /* read */
  31.   do result = biosdisk( 2, drive, 0, 0, 1, 1, buffer );
  32.   while ( result == 0x06 );
  33.  
  34.   if ( result ) return result;
  35.  
  36.   /* write */
  37.   result = biosdisk( 3, drive, 0, 0, 1, 1, buffer );
  38.  
  39.   return result;
  40. }
  41.